<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateVersionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('version', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->tinyInteger('type')->comment('类型 1-安卓 2-ios');
            $table->string('version', 16)->index()->comment('版本号');
            $table->tinyInteger('status')->comment('状态 1-启用 2-禁用');
            $table->string('url')->nullable()->comment('下载地址');
            $table->string('content')->nullable()->comment('更新描述');
            $table->tinyInteger('is_apk')->default(0)->comment('是否apk地址 0-否 1-是');
            $table->tinyInteger('is_force')->default(0)->comment('是否强制更新  0-否 1-是');
            $table->timestamps();
            $table->unique(['type', 'version']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('version');
    }
}
